/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package br.gov.ana.entities;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author lucas.nunes
 */
@Entity
@Table(name = "QLTTB_MEIO_TRANSMISSAO")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "MeioTransmissao.findAll", query = "SELECT m FROM MeioTransmissao m"),
    @NamedQuery(name = "MeioTransmissao.findByMetId", query = "SELECT m FROM MeioTransmissao m WHERE m.metId = :metId"),
    @NamedQuery(name = "MeioTransmissao.findByMetNm", query = "SELECT m FROM MeioTransmissao m WHERE m.metNm = :metNm"),
    @NamedQuery(name = "MeioTransmissao.findByMetDs", query = "SELECT m FROM MeioTransmissao m WHERE m.metDs = :metDs")})
public class MeioTransmissao implements Serializable {
    private static final long serialVersionUID = 1L;
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    @Id
    @Basic(optional = false)
    @NotNull
    @Column(name = "MET_ID")
    private BigDecimal metId;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 104)
    @Column(name = "MET_NM")
    private String metNm;
    @Size(max = 4000)
    @Column(name = "MET_DS")
    private String metDs;
    @JoinColumn(name = "MET_TMT_ID", referencedColumnName = "TMT_ID")
    @ManyToOne(optional = false)
    private TipoMeioTransmissao metTmtId;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "cvhMetId")
    private List<CaracterizacaoVhm> caracterizacaoVhmList;

    public MeioTransmissao() {
    }

    public MeioTransmissao(BigDecimal metId) {
        this.metId = metId;
    }

    public MeioTransmissao(BigDecimal metId, String metNm) {
        this.metId = metId;
        this.metNm = metNm;
    }

    public BigDecimal getMetId() {
        return metId;
    }

    public void setMetId(BigDecimal metId) {
        this.metId = metId;
    }

    public String getMetNm() {
        return metNm;
    }

    public void setMetNm(String metNm) {
        this.metNm = metNm;
    }

    public String getMetDs() {
        return metDs;
    }

    public void setMetDs(String metDs) {
        this.metDs = metDs;
    }

    public TipoMeioTransmissao getMetTmtId() {
        return metTmtId;
    }

    public void setMetTmtId(TipoMeioTransmissao metTmtId) {
        this.metTmtId = metTmtId;
    }

    @XmlTransient
    public List<CaracterizacaoVhm> getCaracterizacaoVhmList() {
        return caracterizacaoVhmList;
    }

    public void setCaracterizacaoVhmList(List<CaracterizacaoVhm> caracterizacaoVhmList) {
        this.caracterizacaoVhmList = caracterizacaoVhmList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (metId != null ? metId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof MeioTransmissao)) {
            return false;
        }
        MeioTransmissao other = (MeioTransmissao) object;
        if ((this.metId == null && other.metId != null) || (this.metId != null && !this.metId.equals(other.metId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "br.gov.ana.service.MeioTransmissao[ metId=" + metId + " ]";
    }
    
}
